
class Calculator {
  calculate (stay, priceWeek, priceWeekend) {
    return (stay.getWeekDays() * priceWeek) + (stay.getWeekendDays() * priceWeekend)
  }

  calculateBudget (stay, rate) {
    const priceWeek = rate.getPriceWeek()
    const priceWeekend = rate.getPriceWeekend()
    return this.calculatePrice(stay, priceWeek, priceWeekend)
  }

  calculatePrice (stay, priceWeek, priceWeekend) {
    if (this.isRegularClient(stay.getClientType())) {
      return this.calculate(stay, priceWeek.getRegularPrice(), priceWeekend.getRegularPrice())
    }
    return this.calculate(stay, priceWeek.getLoyaltyPrice(), priceWeekend.getLoyaltyPrice())
  }

  isRegularClient (clientType) {
    return clientType === 'regular'
  }
}

module.exports = Calculator
